package com.qianfeng.qrcode;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

import com.zbar.lib.CaptureActivity;
import com.zhangwei.day43bluetooth.R;

public class QrCodeActivity extends AppCompatActivity implements View.OnClickListener {
    private Button sacnBtn;
    private static final int QR_REQUEST_CODE = 1232;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_qr_code);
        sacnBtn = (Button) findViewById(R.id.scan_qr_btn);
        sacnBtn.setOnClickListener(this);


    }

    @Override
    public void onClick(View v) {
        Intent intent = new Intent(this, CaptureActivity.class);
        startActivityForResult(intent, QR_REQUEST_CODE);

    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == QR_REQUEST_CODE) {
            String result = data.getExtras().getString("result");

        }
    }
}
